package com.example.tests;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import java.util.Random;
import org.testng.annotations.Test;
import com.example.utils.SortedListOf;

@Test
public class GroupRemovalTests extends TestBase{

	public void testSomeGroupDeleting(){
		//save old state
		SortedListOf<GroupData> oldList = app.getGroupHelper().getUiGroups();
	    
	    Random rnd = new Random();
	    int index = rnd.nextInt(oldList.size()-1);
	    
	    //actions
	    app.getGroupHelper().deleteGroup(index);
		
		// save new state
	    SortedListOf<GroupData> newList = app.getGroupHelper().getUiGroups();
		    
		//compare states
		assertThat (newList, equalTo(oldList.without(index)));
		}
}